#include "../CompareFunctions.h"
#include <UnitTest++/UnitTest++.h>

using namespace MockItNow;

namespace
{
	TEST (CompareByValueComparesStorageValues)
	{
		const Storage<int> five1(5);
		const Storage<int> five2(5);
		const Storage<int> six(6);

		CHECK(CompareByValue(five1, five2).length() == 0);
		CHECK(CompareByValue(five1, six).length() != 0);
	}

	TEST (CompareByMemoryComparesStorageMemory)
	{
		const Storage<int> five1(5);
		const Storage<int> five2(5);
		const Storage<int> six(6);

		CHECK(CompareByMemory(five1, five2).length() == 0);
		CHECK(CompareByMemory(five1, six).length() != 0);
	}

	TEST (CompareByAddressComparesStorageMemory)
	{
		int a = 5;
		int b = 5;

		const Storage<int> five1(a);
		const Storage<int> five2(a);
		const Storage<int> five3(b);

		CHECK(CompareByAddress(five1, five2).length() == 0);
		CHECK(CompareByAddress(five1, five3).length() != 0);
	}
}
